package #Package(${basePackage} "controller");

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import com.baomidou.mybatisplus.core.metadata.IPage;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.QueryBody;
import org.springframework.web.bind.annotation.RequestBody;

import com.tongtu.cyber.common.api.vo.Result;
import #Package(${basePackage} "entity.${EntityName}");
import #Package(${basePackage} "service.${EntityName}Service");
import #Package(${basePackage} "domain.request.dto.${EntityName}Dto");




/**
 * <p>
 *    $table.tableComment
 * </p>
 *
 * @author ${author}
 * @date ${date}
 * @remark ${remark}
 */
@Slf4j
@Api(tags = "${table.tableComment}")
@RestController
@RequestMapping("/#LowerCase(${EntityName})")
public class ${EntityName}Controller {

    @Autowired
    ${EntityName}Service #LowerCase(${EntityName})Service;

    @GetMapping("/pageList")
    @ApiOperation(value = "列表", notes = "列表")
    public Result<IPage<${EntityName}>> pageList(@Validated @QueryBody ${EntityName}Dto.PageListParam pageListParam){
        return #LowerCase(${EntityName})Service.pageList(pageListParam);
    }

    @GetMapping("/detail")
    @ApiOperation(value = "详情", notes = "详情")
    public Result<${EntityName}> detail(@Validated @QueryBody ${EntityName}Dto.DetailParam detailParam){
        return #LowerCase(${EntityName})Service.detail(detailParam);
    }

    @PostMapping("/add")
    @ApiOperation(value = "新增", notes = "新增")
    public Result add(@Validated @RequestBody ${EntityName}Dto.AddParam addParam){
        return #LowerCase(${EntityName})Service.add(addParam);
    }

    @PutMapping("/update")
    @ApiOperation(value = "修改", notes = "修改")
    public Result update(@Validated @RequestBody ${EntityName}Dto.UpdateParam updateParam){
        return #LowerCase(${EntityName})Service.update(updateParam);
    }

    @DeleteMapping("/delete")
    @ApiOperation(value = "删除", notes = "删除")
    public Result delete(@Validated @QueryBody ${EntityName}Dto.DeleteParam deleteParam){
        return #LowerCase(${EntityName})Service.hardDelete(deleteParam);
    }

    @DeleteMapping("/batch/delete")
    @ApiOperation(value = "批量删除", notes = "批量删除")
    public Result batchDelete(@Validated @QueryBody ${EntityName}Dto.BatchDeleteParam batchDeleteParam){
        return #LowerCase(${EntityName})Service.batchHardDelete(batchDeleteParam);
    }


}
